import javax.swing.plaf.synth.SynthOptionPaneUI;

public class Bullet implements Runnable{
    Bullet(int x,int y,int dir){
        this.dir=dir;
        this.x=x;
        this.y=y;
    }
    private int x;
    private int y;
    private int dir;

    public int getX() {
        return x;
    }

    public void setX(int x) {
        this.x = x;
    }

    public int getY() {
        return y;
    }

    public void setY(int y) {
        this.y = y;
    }

    public int getDir() {
        return dir;
    }

    public void setDir(int dir) {
        this.dir = dir;
    }

    public int getSpeed() {
        return speed;
    }

    public void setSpeed(int speed) {
        this.speed = speed;
    }

    private int speed=15;

    public boolean isLife() {
        return life;
    }

    public void setLife(boolean life) {
        this.life = life;
    }

    private boolean life=true;

    @Override
    public void run(){
        while(true){
            try{
                Thread.sleep(50);
            }catch (InterruptedException e){
                throw new RuntimeException((e));
            }

            switch(this.getDir()){
                case 0:
                    this.setY(this.getY()-this.getSpeed());
                    break;
                case 1:
                    this.setY(this.getY()+this.getSpeed());
                    break;
                case 2:
                    this.setX(this.getX()-this.getSpeed());
                    break;
                case 3:
                    this.setX(this.getX()+this.getSpeed());
                    break;
            }
        }
    }
}
